home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 089a.dms / 089a.adf / TEXTS / APPENDIX / Hints&Tips < prev    next >
Text File  |  1992-03-06  |  10KB  |  195 lines

  1.                                 HINTS AND TIPS
  2.                                 --------------
  3. Following are a few hints and tips donated by readers of F1 Licenceware's
  4. Amos programmers disk mag, Amoszine. See Amos contacts for more details. 
  5. -------------------------------------------------------------------------
  6.  
  7. To find out how your program would run under the American NTSC
  8. system just enter this at the start of your listing:
  9.  
  10. Doke $DFF1DC,0
  11.  
  12. To return back to the PAL system use this:
  13.  
  14. Doke $DFF1DC,32
  15.  
  16. You could use these dokes as a switch inside your program making it
  17. almost world-wide compatible.
  18. --------------------------------------------------------------------------
  19.  
  20. Don't use multiple if's 
  21. ----------------------  
  22. For example.
  23.  
  24. If A=1 Then Proc A1
  25. If A=2 Then Proc A2
  26. If A=3 Then Proc A3
  27. If A=4 Then Proc A4
  28.  
  29. Can be replaced with. 
  30.  
  31. On A Proc A1,A2,A3,A4
  32.  
  33. Although this method can not pass variables, it is much faster than using
  34. multiple IF's with more conditions resulting in more of a gain in speed.  
  35. ---------------------------------------------------------------------------
  36.  
  37. Save some memory
  38. ----------------
  39. SET SPRITE BUFFER 16  (If not using any sprites/bobs. Saves about 10k)
  40.  
  41. CLOSE WORKBENCH       (saves around 40k)                              
  42.                                                                        
  43. CLOSE EDITOR          (saves about 26k)                               
  44. ---------------------------------------------------------------------------
  45.                                               
  46. Is disk write protected or not?                               
  47. ---------------------------------------                               
  48. POKE $BFD100,%10000      `Change to %1000 FOR DF1:                    
  49. A=BTST (3,$BFE001)                                                    
  50. IF A=-1 THEN PRINT "DISK WRITE ENABLED"                               
  51. IF A= 0 THEN PRINT "DISK WRITE PROTECTED"
  52. ---------------------------------------------------------------------------
  53.                                                                        
  54. Change mouse pointer colours                                          
  55. ----------------------------                                          
  56. COLOUR 17,$FFF                                                        
  57. COLOUR 18,$123                                                        
  58. COLOUR 19,$0
  59.  
  60. Obviously change the $rgb values to what you want.
  61. ---------------------------------------------------------------------------
  62.                                                                        
  63. Print a line of anything                                              
  64. ------------------------                                              
  65. PRINT STRING$ ("^",80)    ` will print 80 ^ on screen                 
  66. PRINT SPACE$ (80)          `Will print 80 spaces                      
  67.  
  68. Note:                                                                 
  69. You can put anything inside the " " of the first line and change the 
  70. 80 to any number you wish. The normal equivalent line would be:
  71.  
  72.  PRINT"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^etc"
  73.  
  74. Ugly, more byte consuming and possibly slower.
  75. ---------------------------------------------------------------------------
  76.                                                                        
  77. Clear just a portion of the screen                                    
  78. -----------------------------------                                   
  79. CLS 12,14,39 to 305,70                                                
  80.                                                                        
  81. The 12 is a colour                                                    
  82. the 14,39 is the top right coordinates of the portion to clear        
  83. and the 305,70 is the bottom left coordinates                         
  84.  
  85. This can be a very useful instruction but is overlooked by a lot of people.
  86. ---------------------------------------------------------------------------
  87.                                                                        
  88. Display palette                                                       
  89. ---------------                                                       
  90. Here is a neat little three liner that will display the colours of the 
  91. current palette in use, like in an art package.                       
  92.                                                                        
  93. FOR L=0 TO 15: INK L                `set to loop 16 times 0-15        
  94. BAR (L+1)*16,170 TO (L+2)*16,177    `Draw a filled box in INK colour(L
  95. NEXT L                              `If L is less than 15 repeat loop 
  96.                                                   
  97. This will draw 16 filled boxes using the BAR instruction.             
  98. each box will be filled with the current INK colour which is changed by
  99. the FOR NEXT loop using INK L. L starts off with the value 0 and
  100. every time the program hits the NEXT L line it checks L is less than 15
  101. and if so adds 1 to L, when L eventually is equal to 15 the loop is 
  102. completed.
  103. ---------------------------------------------------------------------------
  104.  
  105. Screen wipe                                                           
  106. -----------------
  107. This is the screen wipe used on the loading screen of Amoszine 1.       
  108.  
  109. INK 0                                                                 
  110. FOR X=0 TO 319                                                        
  111. DRAW 0,199 TO X,0                                                     
  112. NEXT X                                                                
  113. FOR Y=1 TO 199                                                        
  114. DRAW 0,199 TO 319,Y                                                   
  115. NEXT Y
  116. ---------------------------------------------------------------------------
  117.                                                                        
  118. Centre Text V2                                                        
  119. --------------                                                        
  120. This is a handy routine that will centre any text inside T$ on to the 
  121. screen This works for both horizontal and vertical positions, unlike the 
  122. CENTRE instruction. 
  123.                                                                        
  124. T$="MONGOLIAN INTRUDERS FROM PLANET RED"         ` Put some text in T$
  125. A=LEN(T$)                                        ` How long is it?    
  126. TEXT SCREEN WIDTH/2 - (A*8/2), SCREEN HEIGHT/2,T$` See below          
  127.                                                                        
  128. First we put the message we want printed into T$ and then A is told to
  129. hold the length of T$.                                                
  130.                                                                        
  131. TEXT is very similar to print except it can place the TEXT cursor 
  132. anywhere on screen to a pixel, where as LOCATE and PRINT can only be 
  133. defined by 8 pixels (or one character square if you like.)            
  134.                                                                        
  135. SCREEN WIDTH returns the WIDTH of the SCREEN and SCREEN HEIGHT does 
  136. what you would expect.  The calculation performed gives the exact 
  137. central x,y position on the screen to place the text in T$. For example
  138. SCREEN HEIGHT/2 will be exactly half way down the screen, 
  139. SCREEN WIDTH/2 half way across.   
  140. ---------------------------------------------------------------------------
  141.                                                                        
  142. This is the routine Lee Bamber wrote for the clock we use in Amoszine.
  143. ----------------------------------------------------------------------
  144. REM Clock, By Lee Bamber for Amoszine                                 
  145.                                                                        
  146. REM Set up vars for hours minutes and seconds                         
  147. Time=Timer:Times=0:Timem=0:Timeh=0                                    
  148.                                                                        
  149. Rem your main loop                                                    
  150.  
  151. Do                                                                    
  152. Gosub CONSTRUCT_TIME                                                  
  153. Loop                                                                  
  154.                                                                        
  155. REM The subroutine                                                    
  156.  
  157. CONSTRUCT_TIME:                                                       
  158. Time$=((Timer-time)/50)
  159. If Times>=60                                                          
  160.    Times=0:Time=Timer                                                 
  161.    Inc Timem                                                          
  162. If Timem>=60                                                          
  163.    Timem=0                                                            
  164.    Inc timeh                                                          
  165. Endif                                                                 
  166. Endif                                                                 
  167.                                                                        
  168. REM The following two lines should be all on one, 
  169.     I couldn't fit it on here.
  170.  
  171. Time$=Mid$(Str$(100+Timeh),3,2)+":"+Mid$(Str$(100+Timem),3,2)+":"+Mid$
  172. (Str$(100+Times),3,2                                                  
  173.                                                                        
  174. Pen 1:Paper 0:Home:Print Time$                                        
  175. Return
  176. ---------------------------------------------------------------------------
  177. Amos Pro users in need of some light (very light!) Entertainment
  178. should do the following. Type in the following names, with quotes:
  179.  
  180. "Vanner"
  181. "Lionet"
  182. "Pudsie"
  183. "Daisy"
  184. "Carrine"
  185. "Mel"
  186. "Stephen"
  187. "Dithel"
  188.  
  189. Now move the cursor to the beginning of a name and press HELP for 
  190. some vaguely interesting messages.
  191. ---------------------------------------------------------------------------
  192.  
  193.                             END OF HINTS AND TIPS
  194.                             ^^^^^^^^^^^^^^^^^^^^^
  195.